home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 August: Tool Chest / Dev.CD Aug 94.toast / New System Software Extensions / ColorSync™ 1.0.5 / Interfaces / PInterfaces / CMApplication.p next >
Encoding:
Text File  |  1994-04-11  |  8.3 KB  |  330 lines  |  [TEXT/MPS ]

  1. {
  2.     File:        CMApplication.p
  3.  
  4.     Contains:    Header for Color Matching aware applications
  5.  
  6.     Copyright:    © 1992-94 by Apple Computer, Inc., all rights reserved.
  7.  
  8. }
  9.  
  10. {$IFC UNDEFINED UsingIncludes}
  11. {$SETC UsingIncludes := 0}
  12. {$ENDC}
  13.  
  14. {$IFC NOT UsingIncludes}
  15.  UNIT CMApplication;
  16.  INTERFACE
  17. {$ENDC}
  18.  
  19. {$IFC UNDEFINED UsingCMApplication}
  20. {$SETC UsingCMApplication := 1}
  21.  
  22. {$I+}
  23. {$SETC CMApplicationIncludes := UsingIncludes}
  24. {$SETC UsingIncludes := 1}
  25.  
  26. {$IFC UNDEFINED UsingTypes}
  27. {$I $$Shell(PInterfaces)Types.p}
  28. {$ENDC}
  29.  
  30. {$IFC UNDEFINED UsingQuickdraw}
  31. {$I $$Shell(PInterfaces)Quickdraw.p}
  32. {$ENDC}
  33.  
  34. {$IFC UNDEFINED UsingPrinting}
  35. {$I $$Shell(PInterfaces)Printing.p}
  36. {$ENDC}
  37.  
  38. {$SETC UsingIncludes := CMApplicationIncludes}
  39.  
  40.  
  41. CONST
  42.  
  43. gestaltColorMatchingVersion    = 'cmtc';
  44. CMTrap = $ABEE;
  45.  
  46. { PicComments }
  47. CMBeginProfile = 220;
  48. CMEndProfile = 221;
  49. CMEnableMatching = 222;
  50. CMDisableMatching = 223;
  51.  
  52. { Defines for fieldMask in profile search record }
  53. kMatchCMMType = $00000001;
  54. kMatchApplProfileVersion = $00000002;
  55. kMatchDataType = $00000004;
  56. kMatchDeviceType = $00000008;
  57. kMatchDeviceManufacturer = $00000010;
  58. kMatchDeviceModel = $00000020;
  59. kMatchDeviceAttributes = $00000040;
  60. kMatchFlags = $00000080;
  61. kMatchOptions = $00000100;
  62. kMatchWhite = $00000200;
  63. kMatchBlack = $00000400;
  64.  
  65. { Profile Header version }
  66. kCMApplProfileVersion = $0100;
  67.  
  68. { Data types }
  69. rgbData = 'RGB ';
  70. cmykData = 'CMYK';
  71. grayData = 'GRAY';
  72. xyzData = 'XYZ ';
  73.  
  74. { Device types }
  75. monitorDevice = 'mntr';
  76. scannerDevice = 'scnr';
  77. printerDevice = 'prtr';
  78. qdSystemDevice = 'sys ';
  79. qdGDevice = 'gdev';
  80.  
  81. { Profile flags }
  82. CMNativeMatchingPreferred = $00000001;            { Default to native not preferred }
  83. CMTurnOffCache = $00000002;                        { Default to turn on CMM cache }
  84.  
  85. { Profile options }
  86. CMPerceptualMatch = $00000000;                    { Default. For photographic images }
  87. CMColorimetricMatch = $00000001;                { Exact matching when possible }
  88. CMSaturationMatch = $00000002;                    { For solid colors }
  89.  
  90. { ColorSync result codes }
  91. CMNoError = 0;
  92. CMProfileError = -170;
  93. CMMethodError = -171;
  94. CMMemFullError = -172;
  95. CMUnimplementedError = -173;
  96. CMParamError = -174;
  97. CMMethodNotFound = -175;                        { CMM not present }
  98. CMProfileNotFound = -176;                        { Responder error }
  99. CMProfilesIdentical = -177;                        { Profiles the same }
  100. CMCantConcatenateError = -178;                    { Profile can't be concatenated }
  101. CMCantXYZ = -179;                                { CMM cant handle XYZ space }
  102. CMCantDeleteProfile = -180;                        { Responder error }
  103. CMUnsupportedDataType = -181;                    { Responder error }
  104. CMNoCurrentProfile = -182;                        { Responder error }
  105.  
  106. grayResponse = 0;
  107. redResponse = 1;
  108. greenResponse = 2;
  109. blueResponse = 3;
  110. cyanResponse = 4;
  111. magentaResponse = 5;
  112. yellowResponse = 6;
  113. ucrResponse = 7;
  114. bgResponse = 8;
  115. onePlusLastResponse = 9;
  116.  
  117. { Printing Stuff that will be moved later }
  118. enableColorMatchingOp = 12;
  119. registerProfileOp = 13;
  120.  
  121.  
  122. TYPE
  123.  
  124. CMMatchFlag = LONGINT;
  125. CMMatchOption = LONGINT;
  126. CMMatchRef = LONGINT;
  127. CWorld = LONGINT;
  128. CMError = LONGINT;
  129. CMResponseData = INTEGER;
  130.  
  131. CMGamutResult = ^LONGINT;                        { Pointer to bit array }
  132.  
  133. PixMapCallBackProcPtr = ProcPtr;                { FUNCTION CallBack(progress: LONGINT; refCon: LONGINT): BOOLEAN; }
  134.  
  135.  
  136. XYZColor = RECORD
  137.     X: INTEGER;                                    { 1.15 bit unsigned fixed point }
  138.     Y: INTEGER;
  139.     Z: INTEGER;
  140. END;
  141.  
  142.  
  143. CMYKColor = RECORD
  144.     cyan: INTEGER;
  145.     magenta: INTEGER;
  146.     yellow: INTEGER;
  147.     black: INTEGER;
  148. END;
  149.  
  150.  
  151. CMColorList = ^CMColor;
  152. CMColor = RECORD
  153.     CASE INTEGER OF
  154.         1: (rgb: RGBColor);
  155.         2: (xyz: XYZColor);
  156.         3: (cmyk: CMYKColor);
  157. END;
  158.  
  159.  
  160. CMHeader = RECORD
  161.     size: LONGINT;                                { This is the total size of the Profile including custom data }
  162.     CMMType: OSType;                            { Corresponding CMM }
  163.     applProfileVersion: LONGINT;                { Version of CMProfile format }
  164.     dataType: OSType;                            { rgbData, etc. }
  165.     deviceType: OSType;                            { monitorDevice, etc. }
  166.     deviceManufacturer: OSType;                    { Registered with DTS }
  167.     deviceModel: LONGINT;                        { Specific to Manufacturer }
  168.     deviceAttributes: ARRAY[0..1] OF LONGINT;    { Attributes like paper, ink, etc. }
  169.     profileNameOffset: LONGINT;                    { Offset to profile name from top of data }
  170.     customDataOffset: LONGINT;                    { Offset to custom data from top of data }
  171.     flags: CMMatchFlag;
  172.     options: CMMatchOption;
  173.     white: XYZColor;
  174.     black: XYZColor;
  175. END;
  176.  
  177.  
  178. CMProfileSearchRecordHandle = ^CMProfileSearchRecordPtr;
  179. CMProfileSearchRecordPtr = ^CMProfileSearchRecord;
  180.  
  181. CMProfileSearchRecord = RECORD
  182.     header: CMHeader;
  183.     fieldMask: LONGINT;
  184.     reserved: ARRAY[0..1] OF LONGINT;
  185. END;
  186.  
  187.  
  188. CMProfileChromaticities = RECORD
  189.     red: XYZColor;
  190.     green: XYZColor;
  191.     blue: XYZColor;
  192.     cyan: XYZColor;
  193.     magenta: XYZColor;
  194.     yellow: XYZColor;
  195. END;
  196.  
  197.  
  198. IStringHandle = ^IStringPtr;
  199. IStringPtr = ^IString;
  200.  
  201. IString = RECORD
  202.     theScript: ScriptCode;
  203.     theString: Str63;
  204. END;
  205.  
  206.  
  207. CMProfileResponse = RECORD
  208.     counts: ARRAY[grayResponse..bgResponse] OF INTEGER;
  209.     data: ARRAY[0..0] OF CMResponseData;
  210. END;
  211.  
  212.  
  213. CMProfileHandle = ^CMProfilePtr;
  214. CMProfilePtr = ^CMProfile;
  215.  
  216. CMProfile = RECORD
  217.     header: CMHeader;
  218.     profile: CMProfileChromaticities;
  219.     response: CMProfileResponse;            { Variable size }
  220.     profileName: IString;                    { Variable size }
  221.     customData: ARRAY[0..0] OF INTEGER;        { Optional variable length custom CMM data. Word aligned. }
  222. END;
  223.  
  224.  
  225. { Printing Stuff that will be moved later }
  226. { PrGeneral parameter blocks }
  227.  
  228. TEnableColorMatchingBlk = RECORD
  229.     iOpCode: INTEGER;
  230.     iError: INTEGER;
  231.     lReserved: LONGINT;
  232.     hPrint: THPrint;
  233.     fEnableIt: BOOLEAN;
  234. END;
  235.  
  236.  
  237. TRegisterProfileBlk = RECORD
  238.     iOpCode: INTEGER;
  239.     iError: INTEGER;
  240.     lReserved: LONGINT;
  241.     hPrint: THPrint;
  242.     fRegisterIt: BOOLEAN;
  243. END;
  244.  
  245.  
  246. { High Level Calls }
  247.  
  248. FUNCTION BeginMatching(src: CMProfileHandle; dst: CMProfileHandle; VAR myRef: CMMatchRef): CMError;
  249.     INLINE $203C, $000C, $000A, $ABEE;
  250.  
  251. PROCEDURE EndMatching(myRef: CMMatchRef);
  252.     INLINE $203C, $0004, $000B, $ABEE;
  253.  
  254. FUNCTION GetProfile(deviceType: OSType; refNum: LONGINT; aProfile: CMProfileHandle;
  255.                     VAR returnedProfile: CMProfileHandle): CMError;
  256.     INLINE $203C, $0010, $0005, $ABEE;
  257.  
  258. FUNCTION SetProfile(deviceType: OSType; refNum: LONGINT; newProfile: CMProfileHandle): CMError;
  259.     INLINE $203C, $000C, $0006, $ABEE;
  260.  
  261. FUNCTION SetProfileDescription(deviceType: OSType; refNum: LONGINT; deviceData: UNIV LONGINT;
  262.                                hProfile: CMProfileHandle): CMError;
  263.     INLINE $203C, $0010, $0010, $ABEE;
  264.  
  265. FUNCTION GetColorSyncFolderSpec(vRefNum: INTEGER; createFolder: BOOLEAN; VAR foundVRefNum: INTEGER;
  266.                                 VAR foundDirID: LONGINT): CMError;
  267.     INLINE $203C, $000C, $0011, $ABEE;
  268.  
  269. FUNCTION GetIndexedProfile(deviceType: OSType; refNum: LONGINT; search: CMProfileSearchRecordHandle;
  270.                            VAR returnProfile: CMProfileHandle; VAR index: LONGINT): CMError;
  271.     INLINE $203C, $0014, $0012, $ABEE;
  272.  
  273. FUNCTION DeleteDeviceProfile(deviceType: OSType; refNum: LONGINT; deleteMe: CMProfileHandle): CMError;
  274.     INLINE $203C, $000C, $0013, $ABEE;
  275.  
  276. { Data interchange routines }
  277.  
  278. FUNCTION UseProfile(profile: CMProfileHandle): CMError;
  279.     INLINE $203C, $0004, $0008, $ABEE;
  280.  
  281. PROCEDURE DrawMatchedPicture(myPicture: PicHandle; dst: CMProfileHandle; myRect: Rect);
  282.     INLINE $203C, $000C, $0009, $ABEE;
  283.  
  284. PROCEDURE EnableMatching(enableIt: BOOLEAN);
  285.     INLINE $203C, $0002, $000D, $ABEE;
  286.  
  287. { Profile concatenation }
  288.  
  289. FUNCTION ConcatenateProfiles(thru: CMProfileHandle; dst: CMProfileHandle;
  290.                              VAR newDst: CMProfileHandle): CMError;
  291.     INLINE $203C, $000C, $000C, $ABEE;
  292.  
  293. { Profile manipulation routines }
  294.  
  295. PROCEDURE GetProfileName(myProfile: CMProfileHandle; VAR IStringResult: IString);
  296.     INLINE $203C, $0008, $000E, $ABEE;
  297.  
  298. FUNCTION GetProfileAdditionalDataOffset(myProfile: CMProfileHandle): LONGINT;
  299.     INLINE $203C, $0004, $000F, $ABEE;
  300.  
  301. { Low level color calculation routines }
  302.  
  303. FUNCTION CWNewColorWorld(VAR myCWorld: CWorld; src: CMProfileHandle; dst: CMProfileHandle): CMError;
  304.     INLINE $203C, $000C, $0000, $ABEE;
  305.  
  306. PROCEDURE CWDisposeColorWorld(myCWorld: CWorld);
  307.     INLINE $203C, $0004, $0001, $ABEE;
  308.  
  309. FUNCTION CWMatchColors(myCWorld: CWorld; myColors: CMColorList; count: LONGINT): CMError;
  310.     INLINE $203C, $000C, $0002, $ABEE;
  311.  
  312. FUNCTION CWCheckColors(myCWorld: CWorld; myColors: CMColorList; count: LONGINT;
  313.                        result: CMGamutResult): CMError;
  314.     INLINE $203C, $0010, $0003, $ABEE;
  315.  
  316. FUNCTION CWMatchPixMap(myCWorld: CWorld; myPixMap: PixMap; progressProc: PixMapCallBackProcPtr;
  317.                        refCon: LONGINT): CMError;
  318.     INLINE $203C, $0010, $0004, $ABEE;
  319.  
  320. FUNCTION CWCheckPixMap(myCWorld: CWorld; myPixMap: PixMap; progressProc: PixMapCallBackProcPtr;
  321.                        refCon: LONGINT; VAR resultBitMap: BitMap): CMError;
  322.     INLINE $203C, $0014, $0007, $ABEE;
  323.  
  324.  
  325. {$ENDC UsingCMApplication}
  326.  
  327. {$IFC NOT UsingIncludes}
  328. END.
  329. {$ENDC}
  330.